import { trimStart } from 'lodash-unified'

/**
 * 字符串工具类
 */
export class StringUtil {
  /**
   * 删除开始字符串
   * @param str 原始字符串
   * @param start 开始字符串
   */
  static removeStart(str: string, start: string) {
    return trimStart(str, start)
  }

  /**
   * 删除前后字符串
   * @param str 原始字符串
   * @param start 开始字符串
   * @param end 结束字符串
   */
  static substringBetween(str: string, start: string, end: string) {
    const startIndex = str.indexOf(start) + start.length
    const endIndex = str.indexOf(end)

    return str.substring(startIndex, endIndex)
  }
}
